<?php


namespace app\common\lib\sms;


class ClassArr
{
    public static function smsClassStat()
    {
        return [
            'ali' => "app\common\lib\sms\AliSms",
            'baidu' => "app\common\lib\sms\BaiduSms"
        ];
    }


    public static function initClass($type, $classs, $param = [], $needInstance = false)
    {
        //工厂调用的方法是静态的,那么就返回类库
        //如果不是静态的,就返回对象
        if (!array_key_exists($type, $classs)) {
            return false;
        }

        $className = $classs[$type];

        return $needInstance == true ? (new \ReflectionClass($className))->newInstanceArgs($param) : $className;

    }

}